/* ==========================================================================
   布局 (Layout)
   ========================================================================== */

#app {
    height: calc(100vh - 70px);
    margin-top: 40px;
}

.service-and-category-container {
    display: flex;
    height: calc(100% - 60px);
    margin-top: 20px;
}

.category-container {
    width: 20%;
    padding: 10px;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.category-item {
    margin-bottom: 10px;
    cursor: pointer;
}

.category-box {
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.category-box:hover {
    background-color: #f8f9fa;
}

.category-box.active {
    background-color: #e9ecef;
}

.services-container {
    width: 80%;
    padding: 10px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
    flex: 1;
}

/* ==========================================================================
   组件 (Components)
   ========================================================================== */

/* 搜索框 */
.search-box {
    flex: 1;
    max-width: 400px;
}

.search-box .input-group {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-box .form-control {
    border-right: none;
    padding: 8px 12px;
    height: 38px;
}

.search-box .input-group-text {
    background: white;
    border-left: none;
    color: #6c757d;
}

/* 添加服务按钮 */
#add-service-btn {
    padding: 8px 24px;
    font-size: 14px;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    min-width: 120px;
    justify-content: center;
}

/* 手风琴组件 */
.accordion {
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.accordion-item {
    border-bottom: 1px solid #dee2e6;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    padding: 12px 20px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.accordion-header:hover {
    background: #e9ecef;
}

.accordion-content {
    padding: 15px 20px;
    background: #fff;
    display: none;
}

.accordion-content.active {
    display: block;
}

/* 服务信息 */
.service-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.service-info h5 {
    margin: 0;
    font-size: 16px;
}

.service-info small {
    color: #6c757d;
}

/* 服务状态 */
.service-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-status-span {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 5px;
}

/* 服务操作 */
.service-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.service-actions button {
    padding: 6px 12px;
    font-size: 14px;
}

/* 模态窗口 */
.modal {
    display: block;
}

.modal-content {
    width: 600px;
    max-width: 90vw;
    height: 400px;
    max-height: 90vh;
    margin: 0;
    /* border-radius: 4px; */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); */
}

/* ==========================================================================
   状态 (States)
   ========================================================================== */

/* 状态标签 */
.badge {
    padding: 5px 10px;
    border-radius: 4px;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: black;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
}

.badge-info {
    background-color: #6c757d;
    color: white;
}

.badge-basic {
    background-color: #bababa;
    color: black;
}

.badge-primary {
    background-color: #007bff;
    color: white;
}

.badge-secondary {
    background-color: #17a2b8;
    color: black;
}

.badge-third {
    background-color: #6f42c1;
    color: white;
}


.task-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-header h5 {
    margin: 0;
    color: #333;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.3s ease;
}

.progress-text {
    min-width: 40px;
    text-align: right;
    color: #666;
    font-size: 14px;
}

.status-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
}

.status-icon.completed {
    background: #4CAF50;
    color: white;
}

.status-icon.in-progress {
    background: #2196F3;
    color: white;
    animation: spin 1s linear infinite;
}

.status-icon.error {
    background: #f44336;
    color: white;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
} 

.header-buttons {
    display: flex;
    gap: 10px;
}

.header-buttons .btn {
    padding: 8px 24px;
    font-size: 14px;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 120px;
    justify-content: center;
}


#refresh-btn {
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border: none;
}

#refresh-btn:hover {
    background-color: #dddddd;
}

.refresh-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.refresh-btn.loading .refresh-icon {
    transform: rotate(360deg);
    animation: spin 2s linear infinite;
}

.address-input-group {
    display: flex;
    align-items: center;
}

.protocol-label {
    padding: 10px;
    background-color: #b2b2b2;
    margin-right: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.address-input {
    flex: 1;
    margin-left: 0;
}

/* 任务列表 */
.service-tasks {
    border-top: 1px solid #acacac;
    padding-top: 15px;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.task-item:last-child {
    border-bottom: none;
}

.task-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-name {
    font-weight: 500;
}

.selected-file {
    font-size: 0.9em;
    color: #666;
    margin-right: 10px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.task-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}
